//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "ia\fn_delVecCrew.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_object","_delay"];
_object = objNull;
_delay = 0;
if (IS_ARRAY(_this)) then {
	DEFAULT_PARAM(_object,0,objNull);
	DEFAULT_PARAM(_delay,1,0);
} else {
	_object = _this;
};

if (IS_OBJECT(_object) && {!(isNull _object)}) then {
	if (_delay > 0) then {
		sleep (_delay + random(10));
	};
	if (_object isKindOf "man") then {
		_object = vehicle _object;
	};
	{
		_x leaveVehicle _object;
		_x setDamage 1;
		sleep 0.1;
		deleteVehicle _x;
	} foreach (crew _object);
	sleep 0.2;
	deleteVehicle _object;
};

TRACE("End");
TMFPROFILERSTOP;